﻿@page "/Scheduler/Resources/GroupByDate"

<DemoPageSectionComponent Id="Scheduler-Resources-GroupByDate">
    <DemoChildContent>
        <DxScheduler @bind-StartDate="@StartDate"
                     DataStorage="@DataStorage"
                     GroupType="SchedulerGroupType.Date"
                     ResourceColorInHeaderVisible="@ResourceColorInHeaderVisible"
                     CssClass="demo-sc-size">
            <DxSchedulerDayView DayCount="2" ShowWorkTimeOnly="true" CellMinWidth="120"></DxSchedulerDayView>
            <DxSchedulerMonthView CellMinWidth="120"></DxSchedulerMonthView>
            <DxSchedulerTimelineView CellMinWidth="70"></DxSchedulerTimelineView>
        </DxScheduler>
    </DemoChildContent>
    <OptionsContent>
        <OptionCheckBox @bind-Checked="@ResourceColorInHeaderVisible" Label="Resource Color In Header Visible"/>
    </OptionsContent>

    @code {
        DateTime StartDate { get; set; } = DateTime.Today;
        bool ResourceColorInHeaderVisible { get; set; } = true;

        DxSchedulerDataStorage DataStorage = new DxSchedulerDataStorage() {
            AppointmentsSource = ResourceAppointmentCollection.GetAppointments(),
            AppointmentMappings = new DxSchedulerAppointmentMappings() {
                Type = "AppointmentType",
                Start = "StartDate",
                End = "EndDate",
                Subject = "Caption",
                AllDay = "AllDay",
                Location = "Location",
                Description = "Description",
                LabelId = "Label",
                StatusId = "Status",
                RecurrenceInfo = "Recurrence",
                ResourceId = "ResourceId"
            },
            ResourcesSource = ResourceCollection.GetResourcesForGrouping(),
            ResourceMappings = new DxSchedulerResourceMappings() {
                Id = "Id",
                Caption = "Name",
                BackgroundCssClass = "BackgroundCss",
                TextCssClass = "TextCss"
            }
        };
    }
</DemoPageSectionComponent>
